#include<iostream>
#include<string>
#include<set>
#include<sstream>
using namespace std;
int main(){
    string s,str;
    while(getline(cin,s)&&s!="#"){
        istringstream iss(s);
        set<string> sets;
        while (iss>>str)
        {
            sets.insert(str);
        }
        cout<<sets.size()<<endl;
        
    }

}